// translate.config.js
import { Lang } from 'language-translate/types';
import { defineConfig } from 'language-translate/utils';

export default defineConfig({
  proxy: {
    host: '127.0.0.1',
    port: 15236,
    headers: {
      'User-Agent': 'Node'
    }
  },
  fromLang: Lang['zh-CN'],
  fromPath: 'locales/**/*.cn.json',
  incrementalMode: 'fast',
  translate: [
    {
      label: '递归翻译文件夹内json文件并重写文件名',
      targetConfig: [
        {
          targetLang: Lang.en,
          outPath: 'locales',
          rewrite: fileName => fileName.replace('.cn.json', '.en.json'),
        },
        {
          targetLang: Lang.bn,
          outPath: 'locales',
          rewrite: fileName => fileName.replace('.cn.json', '.bn.json'),
        },
        {
          targetLang: Lang.th,
          outPath: 'locales',
          rewrite: fileName => fileName.replace('.cn.json', '.th.json'),
        },
        {
          targetLang: Lang.hi,
          outPath: 'locales',
          rewrite: fileName => fileName.replace('.cn.json', '.hi.json'),
        },
        {
          targetLang: Lang.vi,
          outPath: 'locales',
          rewrite: fileName => fileName.replace('.cn.json', '.vi.json'),
        }
      ]
    }
  ]
})